const Koa = require('koa');
const app = new Koa(); //创建一个应用

//定义中间件
const helloMiddleware = async (ctx, next) => {
    await next();
    ctx.response.type = "text/html"
    ctx.response.body = '<h1>Hello Koa<h1>';
};

app.use(helloMiddleware);

//监听3000端口
app.listen(3000, () => {
    console.log('server is running at http://localhost:3000')
});